﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TRPOP.Common;

namespace TRPOP.CMS.Model
{

    /// <summary>
    /// 手机图片设置
    /// </summary>
    [Serializable]
    public class MobileConfigInfo
    {

        #region  私有变量
        bool m_IsMobile = false;
        int m_MobileMaxWidth = 0;
        int m_MobileMaxHeight = 0;
        string m_MobileExtName = "_mobile";
        #endregion

        #region 成员函数
        /// <summary>
        /// 是否开启手机功能 
        /// </summary>
        public bool IsMobile
        {
            get
            {
                return m_IsMobile;
            }
            set
            {
                m_IsMobile = value;
            }
        }


        /// <summary>
        /// 手机详细信息页面里图片的最大宽度
        /// </summary>
        public int MobileMaxWidth
        {
            get
            {
                return m_MobileMaxWidth;
            }
            set
            {
                m_MobileMaxWidth = value;
            }
        }


        /// <summary>
        /// 手机详细信息页面里图片的最大高度
        /// </summary>
        public int MobileMaxHeight
        {
            get
            {
                return m_MobileMaxHeight;
            }
            set
            {
                m_MobileMaxHeight = value;
            }
        }


        /// <summary>
        /// 应用于手机上压缩后的图片的后缀名
        /// </summary>
        public string MobileExtName
        {
            get
            {
                return m_MobileExtName;
            }
            set
            {
                m_MobileExtName = value;
            }
        }
        #endregion

        #region 构造器
        public MobileConfigInfo()
        {

        }
        public MobileConfigInfo(bool oIsMobile, int oMobileMaxWidth, int oMobileMaxHeight, string oMobileExtName)
        {
            m_IsMobile = oIsMobile;
            m_MobileMaxWidth = oMobileMaxWidth;
            m_MobileMaxHeight = oMobileMaxHeight;
            m_MobileExtName = oMobileExtName;
        }
        #endregion
    }
}
/* 类统一到了   SystemConfigHelper<ClassType> 里
    /// <summary>
    /// 获取手机相关设置的方法
    /// 内容分页
    /// </summary>
    public static class MobileConfigInfoHelper
    {
        static MobileConfigInfo mMobileConfigInfo;
        static string m_MobileConfigFileName = Common.Util.GetMapPath(SystemConst.ConfigRootName + SystemConst.SystemParam_MobileFileName);
        public static MobileConfigInfo ContentPagers
        {
            get
            {
                if (mMobileConfigInfo != null)
                {
                    return mMobileConfigInfo;
                }
                else
                {

                    if (FileUtil.IsExist(m_MobileConfigFileName))
                    {
                        mMobileConfigInfo = SerializationHelper.Load(typeof(MobileConfigInfo), m_MobileConfigFileName) as MobileConfigInfo;
                    }

                    if (mMobileConfigInfo == null)
                    {
                        mMobileConfigInfo = new MobileConfigInfo()
                        {
                            IsMobile = false,
                            MobileMaxWidth = 300,
                            MobileExtName = "_mobile",
                            MobileMaxHeight = 200
                        };

                        SerializationHelper.Save(mMobileConfigInfo, m_MobileConfigFileName);
                    }

                    return mMobileConfigInfo;
                }
            }
        }
    }

    */
